﻿@echo off
chcp 65001 >nul 
setlocal enabledelayedexpansion

rem "在Windows的[x86 Native Tools Command Prompt for VS 2022]命令窗口中执行"
rem "拉取源代码后，构建Windows 32位Release/Debug全部。"
rem "执行前删除Bridge6/{Win32,libs}目录"
rem "执行前删除Bridge6{analysis,BridgeAnalysis,BridgeTest,ChemDLL}/build目录"

echo "7. 构建analysis/Release库..."
cd D:\Work\Bridge6\analysis
mkdir build\win32_release
cd build/win32_release
cmake ..\.. -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DARCH=Win32 
ninja -v -j8
ninja install

echo "8. 构建analysis/Debug库..."
cd D:\Work\Bridge6\analysis
mkdir build\win32_debug
cd build/win32_debug
cmake ..\.. -G "Ninja" -DCMAKE_BUILD_TYPE=Debug -DARCH=Win32
ninja -v -j8
ninja install

echo "9. 构建BridgeAnalysis/Release库..."
cd D:\Work\Bridge6\BridgeAnalysis
mkdir build\win32_release
cd build/win32_release
cmake ..\.. -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DARCH=Win32 
ninja -v -j8
ninja install

echo "10. 构建BridgeAnalysis/Debug库..."
cd D:\Work\Bridge6\BridgeAnalysis
mkdir build\win32_debug
cd build/win32_debug
cmake ..\.. -G "Ninja" -DCMAKE_BUILD_TYPE=Debug -DARCH=Win32
ninja -v -j8
ninja install

echo "11. 构建ChemDLL/Release库..."
cd D:\Work\Bridge6\ChemDLL
mkdir build\win32_release
cd build/win32_release
cmake ..\.. -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DARCH=Win32 
ninja -v -j8
ninja install

echo "12. 构建ChemDLL/Debug库..."
cd D:\Work\Bridge6\ChemDLL
mkdir build\win32_debug
cd build/win32_debug
cmake ..\.. -G "Ninja" -DCMAKE_BUILD_TYPE=Debug -DARCH=Win32
ninja -v -j8
ninja install

echo "13. 构建BridgeTest/Release执行程序..."
cd D:\Work\Bridge6\BridgeTest
mkdir build\win32_release
cd build/win32_release
cmake ..\.. -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DARCH=Win32 
ninja -v -j8
ninja install

echo "14. 构建BridgeTest/Debug执行程序..."
cd D:\Work\Bridge6\BridgeTest
mkdir build\win32_debug
cd build/win32_debug
cmake ..\.. -G "Ninja" -DCMAKE_BUILD_TYPE=Debug -DARCH=Win32
ninja -v -j8
ninja install

echo "15. 测试BridgeTest/Release执行程序..."
cd D:\Work\Bridge6\Win32\Release
.\BridgeTest.exe --gtest_filter=AnalysisTest2*
.\BridgeTest.exe --gtest_filter=ChemDLLTest1*

echo "16. 测试BridgeTest/Debug执行程序..."
cd D:\Work\Bridge6\Win32\Debug
.\BridgeTest.exe --gtest_filter=AnalysisTest2*
.\BridgeTest.exe --gtest_filter=ChemDLLTest1*